Program performance analysis investigates a program's behavior using dynamic information, namely, information that is gathered as the program executes. Static information, which is obtained without running the program, may also be used in performance analysis. A profiler is a tool that obtains information about the dynamic behavior of a program, such as the frequency and duration of function calls, and which calls are made in what order. Some profilers obtain information about memory usage and/or about usage of other resources during program execution.
Profilers may use various techniques to collect data about program execution, such as hardware interrupts, code instrumentation, instruction set simulation, operating system hooks, and/or performance counters. Some profilers probe a program's program counter and call stack at regular intervals, e.g., by using operating system interrupts or dedicated hardware, to obtain samples of program state during execution. Profilers may be part of an Integrated Development Environment (IDE) which also includes a compiler, a debugger, an editor, and other program development tools.
Although application programs are often profiled, other kinds of “programs” (in a broad sense of the word, which is used herein) can also be profiled, such as libraries, drivers, interrupt handlers, threads, processes, and kernels. While and/or after gathering the execution profile data, the profiler and/or other tools may also be used to present and analyze the data. For example, call graphs may be automatically created and displayed, to show the call times, frequencies, and call stacks for developer-specified functions, and corresponding source code may be displayed on request.